﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Zoomtel.Auth.Mvc.Attributes;
using Zoomtel.Persist.BIZ.Models;
using Zoomtel.Service.BIZ;
using Zoomtel.Web.Controllers;

namespace Zoomtel.Web.Areas.BIZ.Controllers
{
    [Description("分销收益接口")]
    public class ProfitController : BizModuleController
    {
        ProfitService _profitService;
        public ProfitController(ProfitService profitService)
        {
            _profitService = profitService;
        }

        [Page]
        [HttpGet]
        [Description("收益列表")]
        public IActionResult Index()
        {
            return View();
        }

        [HttpPost]
        [Description("查询")]
        public Task<IResultModel> QueryCalcResult(ProfitQueryMode model)
        {
            return _profitService.QueryCalcResult(model);
        }


        [HttpPost]
        [Description("计算分销结果")]
        public Task<IResultModel> CalcAndInserProfitAsync(ItemPromotionQueryModel model)
        {
            return _profitService.CalcAndInserProfitAsync(model);
        }
        
        [HttpPost]
        [Description("分销结果撤回")]
        public Task<IResultModel> CalcResultRollBack(ProfitQueryMode model)
        {
            return _profitService.CalcResultRollBack(model);
        }

        [HttpPost]
        [Description("是否已结算")]
        public Task<IResultModel> CheckIsSettle(ProfitQueryMode model)
        {
            return _profitService.CheckIsSettle(model);
        }
    }
}
